package com.dark.common.web.model;


/**
 * 参照EasyUI DataGrid 分页参数
 * sort id
 * order desc
 * orderby id desc
 * page 4
 * pageIndex 3
 * pageNumber 4
 * pageSize 30
 * rows 30 
 * @author Administrator
 *
 */
public class SystemContext {
	
	private static ThreadLocal<String> order = new ThreadLocal<String>() ;
	
	private static ThreadLocal<String> sort = new ThreadLocal<String>() ;
	
	private static ThreadLocal<String> orderby = new ThreadLocal<String>() ;
	
	private static ThreadLocal<Integer> page = new ThreadLocal<Integer>() ;
	
	private static ThreadLocal<Integer> pageIndex = new ThreadLocal<Integer>() ;
	
	private static ThreadLocal<Integer> pageNumber = new ThreadLocal<Integer>() ;
	
	private static ThreadLocal<Integer> pageSize = new ThreadLocal<Integer>() ;
	
	private static ThreadLocal<Integer> rows = new ThreadLocal<Integer>() ;
	
	public static String getOrder() {
		return order.get();
	}
	public static void setOrder(String _order) {
		order.set(_order);
	}
	public static void removeOrder() {
		order.remove() ; 
	}
	
	
	public static String getSort() {
		return sort.get();
	}
	public static void setSort(String _sort) {
		sort.set(_sort);
	}
	public static void removeSort() {
		sort.remove() ; 
	}
	
	
	public static String getOrderby() {
		return orderby.get();
	}
	public static void setOrderby(String _orderby) {
		orderby.set(_orderby);
	}
	public static void removeOrderby() {
		orderby.remove() ; 
	}
	
	
	public static Integer getPage() {
		return page.get();
	}
	public static void setPage(Integer _page) {
		page.set(_page);
	}
	public static void removePage() {
		page.remove() ; 
	}
	
	
	public static Integer getPageIndex() {
		if(null == pageIndex.get()) {
			pageIndex.set(0) ;
		}
		return pageIndex.get();
	}
	public static void setPageIndex(Integer _pageIndex) {
		pageIndex.set(_pageIndex);
	}
	public static void removePageIndex() {
		pageIndex.remove() ; 
	}
	
	
	public static Integer getPageNumber() {
		if(null == pageNumber.get()) {
			pageNumber.set(1) ;
		}
		return pageNumber.get();
	}
	public static void setPageNumber(Integer _pageNumber) {
		pageNumber.set(_pageNumber);
	}
	public static void removePageNumber() {
		pageNumber.remove() ; 
	}
	
	
	public static Integer getPageSize() {
		if(null == pageSize.get()) {
			pageSize.set(30) ;
		}
		return pageSize.get();
	}
	public static void setPageSize(Integer _pageSize) {
		pageSize.set(_pageSize);
	}
	public static void removePageSize() {
		pageSize.remove() ; 
	}
	
	
	public static Integer getRows() {
		return rows.get();
	}
	public static void setRows(Integer _rows) {
		rows.set(_rows);
	}
	public static void removeRows() {
		rows.remove() ; 
	}
	
}
